home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1997 February / PC Plus Super CD (Issue 124) (PCP124-2-97) (February 1997).iso / handson / vbwkshp / options.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-11-07  |  7.7 KB  |  262 lines

  1. VERSION 4.00
  2. Begin VB.Form frmOptions 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Multi Play Options"
  5.    ClientHeight    =   2490
  6.    ClientLeft      =   4200
  7.    ClientTop       =   3165
  8.    ClientWidth     =   3120
  9.    Height          =   2895
  10.    Icon            =   "OPTIONS.frx":0000
  11.    Left            =   4140
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   2490
  16.    ScaleWidth      =   3120
  17.    ShowInTaskbar   =   0   'False
  18.    Top             =   2820
  19.    Width           =   3240
  20.    Begin VB.Frame Frame1 
  21.       Caption         =   "START WITH"
  22.       Height          =   1455
  23.       Left            =   60
  24.       TabIndex        =   4
  25.       Top             =   60
  26.       Width           =   2955
  27.       Begin VB.TextBox txtResume 
  28.          Height          =   285
  29.          Left            =   2040
  30.          Locked          =   -1  'True
  31.          TabIndex        =   10
  32.          Top             =   1080
  33.          Visible         =   0   'False
  34.          Width           =   735
  35.       End
  36.       Begin VB.OptionButton optMethod 
  37.          Caption         =   "Resume at last played:"
  38.          Enabled         =   0   'False
  39.          Height          =   195
  40.          Index           =   3
  41.          Left            =   120
  42.          TabIndex        =   9
  43.          Top             =   1140
  44.          Width           =   1935
  45.       End
  46.       Begin VB.TextBox txtMethod 
  47.          Height          =   285
  48.          Left            =   1320
  49.          TabIndex        =   8
  50.          Top             =   660
  51.          Visible         =   0   'False
  52.          Width           =   1455
  53.       End
  54.       Begin VB.OptionButton optMethod 
  55.          Caption         =   "File name"
  56.          Height          =   195
  57.          Index           =   2
  58.          Left            =   120
  59.          TabIndex        =   7
  60.          Top             =   840
  61.          Width           =   1095
  62.       End
  63.       Begin VB.OptionButton optMethod 
  64.          Caption         =   "File number"
  65.          Height          =   195
  66.          Index           =   1
  67.          Left            =   120
  68.          TabIndex        =   6
  69.          Top             =   540
  70.          Width           =   1155
  71.       End
  72.       Begin VB.OptionButton optMethod 
  73.          Caption         =   "First file"
  74.          Height          =   195
  75.          Index           =   0
  76.          Left            =   120
  77.          TabIndex        =   5
  78.          Top             =   240
  79.          Value           =   -1  'True
  80.          Width           =   2175
  81.       End
  82.    End
  83.    Begin VB.CommandButton cmdCancel 
  84.       Caption         =   "&Cancel"
  85.       Height          =   435
  86.       Left            =   1590
  87.       TabIndex        =   1
  88.       Top             =   1980
  89.       Width           =   1455
  90.    End
  91.    Begin VB.CommandButton cmdOK 
  92.       Caption         =   "&OK"
  93.       Height          =   435
  94.       Left            =   60
  95.       TabIndex        =   0
  96.       Top             =   1980
  97.       Width           =   1455
  98.    End
  99.    Begin VB.Label Label3 
  100.       Alignment       =   2  'Center
  101.       Caption         =   "( .mid will be added automatically )"
  102.       Height          =   195
  103.       Left            =   0
  104.       TabIndex        =   3
  105.       Top             =   1740
  106.       Visible         =   0   'False
  107.       Width           =   3105
  108.    End
  109.    Begin VB.Label Label2 
  110.       Alignment       =   2  'Center
  111.       Height          =   195
  112.       Left            =   0
  113.       TabIndex        =   2
  114.       Top             =   1560
  115.       Width           =   3105
  116.    End
  117. Attribute VB_Name = "frmOptions"
  118. Attribute VB_Creatable = False
  119. Attribute VB_Exposed = False
  120. Private Sub cmdCancel_Click()
  121.     Cancelled = True
  122.     Unload frmOptions
  123. End Sub
  124. Private Sub cmdOK_Click()
  125.     'If first choice is chosen (default) then
  126.     If optMethod(0) = True Then
  127.         'set the flag
  128.         StartWhere = 0
  129.     'Otherwise, if second choice is chosen then
  130.     ElseIf optMethod(1) = True Then
  131.         'check to see if it is a numeric value
  132.         If Not IsNumeric(txtMethod.Text) Then
  133.             'If not then
  134.             Beep
  135.             
  136.             '& tell user
  137.             MsgBox "Not Numeric", 48, "Multi Play Options"
  138.             
  139.             'Reset the text
  140.             txtMethod.Text = ""
  141.             
  142.             'Restore focus
  143.             txtMethod.SetFocus
  144.             
  145.             '& exit
  146.             Exit Sub
  147.         'Otherwise, if it is not in the current file range then
  148.         ElseIf Val(txtMethod.Text) < 1 Or Val(txtMethod.Text) > MCIApp.File1.ListCount Then
  149.             Beep
  150.             
  151.             '& tell user
  152.             MsgBox "Number out of range", 48, "Multi Play Options"
  153.             
  154.             'Reset the text
  155.             txtMethod.Text = ""
  156.             
  157.             'Reset the focus
  158.             txtMethod.SetFocus
  159.             
  160.             '& exit
  161.             Exit Sub
  162.         'Otherwise, it was valid so,
  163.         Else
  164.             'Set the flag
  165.             StartWhere = 1
  166.             
  167.             '& identify file
  168.             StartNumber = Val(txtMethod.Text)
  169.         End If
  170.     'Otherwise, if third choice was chosen then
  171.     ElseIf optMethod(2).value = True Then
  172.         'set the flag
  173.         StartWhere = 2
  174.         
  175.         'Check for a file extension
  176.         If InStr(".mid", txtMethod.Text) Then
  177.             'that's the whole filename
  178.             StartName = txtMethod.Text
  179.         'Otherwise,
  180.         Else
  181.             'add the extension to the text
  182.             StartName = txtMethod.Text & ".mid"
  183.         End If
  184.     'Otherwise, if fourth choice is chosen then
  185.     ElseIf optMethod(3).value = True Then
  186.         'Set the flag
  187.         StartWhere = 3
  188.         
  189.         'Identify the file
  190.         FileMark = Val(txtResume.Text) - 1
  191.     End If
  192.     '& finish
  193.     Unload frmOptions
  194. End Sub
  195. Private Sub Form_Load()
  196.     'Centre form
  197.     Top = (Screen.Height - Height) / 2
  198.     Left = (Screen.Width - Width) / 2
  199. End Sub
  200. Private Sub optMethod_Click(Index As Integer)
  201.     'If first option then
  202.     If Index = 0 Then
  203.         'reset text & caption
  204.         txtMethod.Text = ""
  205.         Label2.Caption = ""
  206.         
  207.         '& hide them
  208.         Label3.Visible = False
  209.         txtMethod.Visible = False
  210.     'Otherwise if second option then
  211.     ElseIf Index = 1 Then
  212.         'reset text & caption
  213.         txtMethod.Visible = True
  214.         txtMethod.Text = ""
  215.         
  216.         'Show only appropriate label
  217.         Label3.Visible = False
  218.         Label2.Caption = "Enter a file number && click OK"
  219.         
  220.         '& set the focus
  221.         txtMethod.SetFocus
  222.     'Otherwise, if third option then
  223.     ElseIf Index = 2 Then
  224.         'show the text box
  225.         txtMethod.Visible = True
  226.         
  227.         'Reset the text
  228.         txtMethod.Text = ""
  229.         
  230.         'Set appropriate caption
  231.         Label2.Caption = "Enter a file name && click OK"
  232.         
  233.         '& show it
  234.         Label3.Visible = True
  235.         
  236.         'Set the focus
  237.         txtMethod.SetFocus
  238.     'Otherwise, if fourth option then
  239.     ElseIf Index = 3 Then
  240.         'Reset text & caption
  241.         txtMethod.Text = ""
  242.         Label2.Caption = ""
  243.         
  244.         'show appropriate text box
  245.         Label3.Visible = False
  246.         txtMethod.Visible = False
  247.         txtResume.Visible = True
  248.     End If
  249. End Sub
  250. Private Sub txtMethod_KeyPress(KeyAscii As Integer)
  251.     'Stop that beep
  252.     If KeyAscii = 13 Then
  253.         KeyAscii = 0
  254.     End If
  255. End Sub
  256. Private Sub txtResume_KeyPress(KeyAscii As Integer)
  257.     'Stop that beep
  258.     If KeyAscii = 13 Then
  259.         KeyAscii = 0
  260.     End If
  261. End Sub
  262.